package com.cheer.dao;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.cheer.entity.MallSalesroomEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * 门店表
 *
 * @author cheer
 */
@Mapper
@Repository
public interface MallSalesroomDao extends BaseMapper<MallSalesroomEntity> {

    default IPage<MallSalesroomEntity> selectPageByShopId(Integer pageNum, Integer pageSize, Long shopId) {
        return selectPage(new Page<>(pageNum, pageSize), new QueryWrapper<MallSalesroomEntity>()
                .eq("shop_id", shopId));
    }

    default List<MallSalesroomEntity> selectByShopId(Long shopId) {
        return selectList(new QueryWrapper<MallSalesroomEntity>()
                .eq("shop_id", shopId));
    }
}
